#!/usr/bin/env bash

set -o nounset
set -o errexit
set -o pipefail

MODEL_DIR=$1
shift
WRAP_MODEL_PARAMS="$@"

cd $MODEL_DIR
BASE_LOCAL_DIR=$(pwd)

BASE_VM_DIR=${BASE_LOCAL_DIR}

set -x
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_API_VERSION
docker run --rm -it \
    -v ${BASE_VM_DIR}:/work seldonio/core-python-wrapper:0.3 \
    bash -c "rm -rfv /work/build && cd /wrappers/python && python wrap_model.py /work $WRAP_MODEL_PARAMS && ls -1 /work/build"
set +x
cd build && make build_docker_image

